package com.apartment.dao;

import com.apartment.data.view.Indentview;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Author : xuzhiyong
 * Date : 2022/6/3 23:01
 */
public interface IndentviewDao extends JpaRepository<Indentview,Integer> {

    @Query(value = "select i.id,i.user_id,i.landlord_id,i.apartment_id,i.username,i.landlord_username,i.begintime,i.endtime,i.address,i.content,i.price,i.picture,i.pay_status from Indentview i where i.user_id=?1", nativeQuery = true)
    List<Indentview> findIndentviewByUserId(Integer id);

    @Query(value = "select i.id,i.user_id,i.landlord_id,i.apartment_id,i.username,i.landlord_username,i.begintime,i.endtime,i.address,i.content,i.price,i.picture,i.pay_status from Indentview i where i.id=?1", nativeQuery = true)
    Indentview findIndentviewById(Integer id);
}
